<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>非单文件组件</title>
    <script src="../js/vue.js"></script>
</head>
<body>
    <div id="app">
         <!-- 3.使用组件 -->
        <school></school>
        <student></student>
        <hello></hello>
    </div>
    <script>
        const hello = Vue.extend({
            name:'hello',
            template:`
                <div>
                    <h1>hello</h1>    
                </div>
            `,
        })
        // 全局注册
        Vue.component('hello',hello);

        // 1.定义组件
        const school = Vue.extend({
            name:'school',
            template:`
                <div>
                    <h3>{{name}}</h3>
                    <h4>{{add}}</h4>   
                </div>
            `,
            data(){
                return {
                    name:'武侯区',
                    add:'丰德广场'
                }
            }
        })
        // 1.定义组件
        const student = Vue.extend({
            name:'student',
            template:`
                <div>
                    <h3>{{name}}</h3>
                    <h4>{{age}}</h4>   
                </div>
            `,
            data(){
                return {
                    name:'张三',
                    age:'18'
                }
            } 
        })

        new Vue({
            el:'#app',
            // 2.局部注册组件
            components:{
                school,
                student
            }
        })
    </script>
</body>
</html>